<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<link rel="stylesheet" href="css/center.css" type="text/css">
<%-- <script type="text/javascript" src="jquery.validate-1.13.1.js"></script>
<script type="text/javascript" src="MyDatePicker/WdatePicker.js"></script> --%>


</head>
<body>
	<s:if test="#attr.msg=='yes'">
		<script>
			alert("操作成功");
		</script>
	</s:if>
	<s:elseif test="#session.msg=='yesconfirm'">
		<script>
			alert("已确定对方完成");
		</script>
	</s:elseif>
	<s:elseif test="#request.msg=='noadd'">
		<script>
			alert("操作失败");
		</script>
	</s:elseif>
	<c:remove var="msg" scope="session" />
	<div
		style="width: 970px;height: 40px;margin-top: 10px;margin-left: 170px;"></div>
	<div id="main" style="height: 800px;">
		<div class="mainleft">
			<ul>
				<!-- 此处href应定为一样方便初始化整个页面 -->
				<li class="select"><a href="javascript:void(0);">个人信息 </a></li>
				<li><a href="javascript:void(0);">已发布信息</a></li>
				<li><a href="javascript:void(0);">要完成的任务</a></li>
				<li><a href="javascript:void(0);">已完成的任务 </a></li>

			</ul>
		</div>

		<div class="mainright">
			<div class="content" style="display: block;">
				<h3>个人信息</h3>
				<div id="showUserInfo" style="display: block;margin-top: 20px;">
					<ul>
						<li>用&nbsp;户&nbsp;名:${user.userName}</li>
						<li>电子邮箱:${user.userEmail}</li>
						<li>已绑定手机号码:${user.userTel}</li>
						<li>信&nbsp;用&nbsp;值:${user.creditPoint}</li>
						<li><input type="button" value="修改资料"
							class="buttonupdateInfo " id="updateUserInfoButton"> <input type="button"
							value="修改密码" class="buttonupdatePassword" id="updateUserPasswordButton"></li>
					</ul>
				</div>
				<div id="updateUserPassword" style="display: none;margin-top: 50px;">
					<form action="user_updatePassword?user.userId=${user.userId}"
						id="updateUserPasswordForm" method="post">
						<ul>
							<li>请输入原密码:&nbsp;&nbsp;&nbsp;&nbsp;<input type="password"
								name="usedPassword"></li>
							<li>请输入新密码:&nbsp;&nbsp;&nbsp;&nbsp;<input type="password"
								name="user.userPassword"></li>
							<li>请再次输入新密码:<input type="password" name="confirmPassword">
							</li>
							<li><input type="reset" value="重置内容" class="buttonReset">
								<input type="submit" value="确认修改" class="buttonSubmit">
								<!-- <input type="button" value="返回" class="buttonReturn"> --> <a
								href="user_initUser" class="buttonReturn">返回</a></li>
						</ul>
					</form>
				</div>
				<div id="updateUserInfo" style="display: none;margin-top: 50px;">
					<form action="user_updateInfo?user.userId=${user.userId}"
						id="updateUserInfoForm" method="post">
						<ul>
							<li>用&nbsp;户&nbsp;名:<input type="text" name="user.userName"
								value="${user.userName}"></li>
							<li>电子邮箱:<input type="text" name="user.userEmail"
								value="${user.userEmail}"></li>
							<li><input type="reset" value="重置内容" class="buttonReset">
								<input type="submit" value="确认修改" class="buttonSubmit">
								<a href="user_initUser" class="buttonReturn">返回</a> <!-- <input type="button" value="返回" class="buttonReturn"> -->
							</li>
						</ul>
					</form>
				</div>
			</div>
			<div class="content" style="display: none;">
				<div id="showUserTextusersend" style="display: block;">
					<h3>已发布信息</h3>
					<s:if
						test="#session.usertextusersend!=null&& !#session.usertextusersend.isEmpty()">
						<s:iterator value="#session.usertextusersend" var="t">
							<s:if test="#t.tag==0">
								<span class="en">未被接收的信息</span>
								<table style="border-bottom: 1px dotted;width: 520px;">
									<tr>
										<td>求助内容:${text}<br> <br> 信用值:${transPoint}<br>
											<br> 有效截止至:<fmt:formatDate value="${limitDate}"
												pattern="yyyy-MM-dd HH:mm" /></td>
										<s:if test="#t.image!=null&&#t.image!='no'">
											<td style="width: 280px;" align="center"><img alt=" "
												src="${image}" style="width: 100px;height: 120px"></td>
										</s:if>
										<s:else>
											<td></td>
										</s:else>
									</tr>
									<tr style="height: 10px;"></tr>
									<tr>
										<td align="right" colspan="2"><a
											href="usertext_deleteTask?userText.textId=${textId}&&userText.transPoint=${transPoint}"
											class="buttonDeleteText">删除</a>&nbsp;&nbsp; 
											<a
										  id="buttonUpadateText" class="buttonUpadateText"  onclick="updateText(${textId});return false;">修改</a></td>
									</tr>
								</table>
							</s:if>
							<s:if test="#t.tag==1||#t.tag==2">
								<span class="en">请确认对方完成&nbsp;&nbsp;默认为7天后自动确认</span>
								<table style="border-bottom: 1px dotted; width: 520px;">
									<tr>
										<td>求助内容:${text}<br> <br> 信用值:${transPoint}<br>
											<br> <s:iterator value="#session.users">
												<s:if test="userId==userByUserCatchId">
											帮助者:${userName}<br>
													<br>
											联系电话:${userTel}<br>
													<br>
												</s:if>
											</s:iterator> <s:iterator value="#session.companiesAll">
												<s:if test="companyId==userByUserCatchId">
											帮助者:${companyName}<br>
													<br>
											联系电话:${companyTel}<br>
													<br>
												</s:if>
											</s:iterator> 有效截止至:<fmt:formatDate value="${limitDate}"
												pattern="yyyy-MM-dd HH:mm" /><br> <br> 距自动确认完成还有<font
											color="red">${7-autoaffirmDate}</font>天</td>
										<s:if test="#t.image!=null&&#t.image!='no'">
											<td style="width: 280px;" align="center"><img alt=" "
												src="${image}" style="width: 100px;height: 120px"></td>
										</s:if>
										<s:else>
											<td></td>
										</s:else>
									<tr>
										<td align="right" colspan="3"><a
											href="usertext_affirmTask?userText.textId=${textId}"
											class="buttonComfirmTask">确认完成</a></td>
									</tr>
								</table>
							</s:if>
						</s:iterator>
					</s:if>
					<s:else>
						<ul>
							<li>暂无发布的信息</li>
						</ul>
					</s:else>

				</div>
				<div id="updateText" style="display:none;">
					<h3>信息修改</h3>
					<form action="usertext_updateText" id="updateUserTextForm"
						method="post" enctype="multipart/form-data" class="Form"
						style="margin-top: 30px;width: 480px;">
						<ul>
							<li>求助内容:</li>
							<li><textarea name="userText.text" id="TA1"
									onkeyup="checkLength(this);" style="width:470px;height:100px;"></textarea>
							</li>
							<li style="margin-top: 90px;"><span class="wordage">剩余字数：<span
									id="sy" style="color:Red;">70</span> </span></li>
							<li>信息类型:&nbsp;&nbsp;<select name="userText.type.typeId"
								style="width:150px;height:25px">
									<s:iterator value="#session.typelist" var="t">
										<option value="${t.typeId}">${t.type}</option>
									</s:iterator>
							</select>
							</li>
							<li style="margin-bottom: 5px;">信用值:&nbsp;&nbsp;&nbsp;&nbsp;<input
								type="text" style="width: 150px;" name="userText.transPoint"
								id="transPoint">
							</li>
							<li style="margin-bottom: 5px;">有效期选择:<input type="text"
								onClick="WdatePicker()"
								onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'%y-%M-%d %H:{%m+10}',maxDate:'{%y+1}-%M-%d %H:%m',realDateFmt:'yyyy-MM-dd HH:mm'})"
								style="width: 150px;" name="limitday"></li>
							<li>所上传的图片:</li>
							<li><input type="file" name="image">
							</li>
							<li></li>
							<li></li>
							<li><img alt=" " src="" id="img"
								style="width: 100px;height: 120px;margin-left: 100px;"></li>

							<li><input type="hidden" name="userText.textId"></li>
							<li><input type="hidden" name="userText.image"></li>
							<li></li>
							<li><input type="reset" value="重置内容" class="buttonReset">
								<input type="submit" value="确认修改" class="buttonSubmit">
								<a href="user_initUser" class="buttonReturn">返回</a>
							</li>
						</ul>
					</form>
				</div>
			</div>
			<div class="content" style="display: none;">
				<h3>要完成的任务</h3>
				<s:if
					test="#session.usertextusercatch!=null&& !#session.usertextusercatch.isEmpty()">
					<s:iterator value="#session.usertextusercatch" var="t">
						<table style="border-bottom: 1px dotted;width: 520px;">
							<tr>
								<td>求助内容:${text}<br> <br> 信用值:${transPoint}<br>
									<br> 有效截止至:<fmt:formatDate value="${limitDate}"
										pattern="yyyy-MM-dd HH:mm" /><br> <br>
									求助人:${userByUserSendId.userName }<br> <br>
									电话:${userByUserSendId.userTel}<br> <br></td>
								<s:if test="#t.image!=null&&#t.image!='no'">
									<td style="width: 280px;" align="center"><img alt=" "
										src="${image}" style="width: 100px;height: 120px"></td>
								</s:if>
								<s:else>
									<td></td>
								</s:else>
								</tr>
								<tr style="height: 10px;"></tr>
								<tr>
									<td align="right" colspan="2"><a
										href="usertext_cancelTask?id=${textId}"
										class="buttonDeleteText">取消</a></td>
								</tr>
						</table>
					</s:iterator>
				</s:if>
				<s:else>
					<ul>
						<li>尚无未完成的任务</li>
					</ul>
				</s:else>
			</div>
			<div class="content" style="display: none;">
				<div id="showUserTextdone" style="display: block;">
					<h3>已完成的任务</h3>
					<s:if
						test="#session.usertextdone!=null&& !#session.usertextdone.isEmpty()">
						<s:iterator value="#session.usertextdone" var="t">
							<table style="border-bottom: 1px dotted; width: 520px;">
								<tr>
									<td>求助内容:${text}<br> <br> 信用值:${transPoint}<br>
										<br> 有效截止至:<fmt:formatDate value="${limitDate}"
											pattern="yyyy-MM-dd HH:mm" /></td>
									<s:if test="#t.image!=null&&#t.image!='no'">
										<td style="width: 280px;" align="center"><img alt=" "
											src="${image}" style="width: 100px;height: 120px"></td>
									</s:if>
									<s:else>
										<td></td>
									</s:else>
								<tr>
									<td align="right" colspan="3"><a
										class="buttonUpadateText" id="buttonComplain" onclick="Complain(${textId});return false;">我要申诉</a></td>
								</tr>
							</table>
						</s:iterator>
					</s:if>
					<s:else>
						<ul>
							<li>尚无已完成的任务</li>
						</ul>
					</s:else>
				</div>
				<div id="userTextcomplain" style="display: none;">
					<h3>申诉内容填写</h3>
					<form action="issue_addIssue" id="addIssueForm" method="post"
						class="From" style="margin-top: 30px;width: 480px;">
						<ul>
							<li>求助内容&nbsp;:</li>
							<li>申诉发起人:</li>
							<li>被申诉人ID:</li>
							<li>
							<textarea name="issue.issuedesc" id="TextArea2"
									onkeyup="checkLength1(this)" 
									style="width:470px;height:100px;"
									placeholder="请详细描述申诉原因"></textarea></li>
							<li style="margin-top: 90px;"><span class="wordage">剩余字数：<span
									id="sy2" style="color:Red;">70</span> </span></li>
							<li><input type="hidden" name="issue.textId"></li>
							<li><input type="hidden" name="issue.indicterId"></li>
							<li><input type="hidden" name="issue.defendantId"></li>
							<li><input type="reset" value="重置内容" class="buttonReset">
								<input type="submit" value="申诉提交" class="buttonSubmit">
								<a href="user_initUser" class="buttonReturn">返回</a>
							</li>
						</ul>
					</form>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
